Ext.define('Admin.view.leavehistory.LeaveHistoryViewController', {
    extend: 'Ext.app.ViewController',
    alias: 'controller.leaveHistory',

    leaveHistoryGridPanelSearch:function(){
        var serchApplyTime          =  Ext.util.Format.date(this.lookupReference('leaveGridSerchByApplyTime').getValue(),'Y/m/d H:i:s');
        var serchUserId             =  this.lookupReference('leaveGridSerchByUserId').getValue();
        var store = Ext.getCmp('leaveHistory-grid').getStore();
        
        if (serchApplyTime!='') {
            Ext.apply(store.proxy.extraParams,{
                applyTime:serchApplyTime
            });
        }else{
            if (store.getProxy().extraParams.applyTime!=null) {
                delete store.getProxy().extraParams.applyTime;
            }
        }
        if (serchUserId!=null) {
            Ext.apply(store.proxy.extraParams,{
                userId:serchUserId
            });
        }

        store.load({
            start: 0,
            limit: 25,
            page: 1
        })
    },

    leaveHistoryGridPanelclear:function(){
        this.lookupReference('leaveGridSerchByApplyTime').setValue('');
        this.lookupReference('leaveGridSerchByUserId').setValue('');
    }
})